﻿package mortal.game.view.guide
{
    import Framework.MQ.*;
    import Message.Command.*;
    import Message.DB.Tables.*;
    import Message.Game.*;
    import Message.Public.*;
    import __AS3__.vec.*;
    import com.gengine.core.frame.*;
    import com.gengine.global.*;
    import com.mui.controls.*;
    import extend.language.*;
    import flash.geom.*;
    import flash.utils.*;
    import mortal.common.*;
    import mortal.common.net.*;
    import mortal.component.gLinkText.*;
    import mortal.component.gconst.*;
    import mortal.component.window.*;
    import mortal.game.*;
    import mortal.game.cache.*;
    import mortal.game.cache.packCache.*;
    import mortal.game.events.*;
    import mortal.game.manager.*;
    import mortal.game.mvc.*;
    import mortal.game.resource.*;
    import mortal.game.resource.info.item.*;
    import mortal.game.resource.tableConfig.*;
    import mortal.game.scene3D.ai.*;
    import mortal.game.scene3D.ai.ais.*;
    import mortal.game.scene3D.ai.singleAIs.autofight.*;
    import mortal.game.scene3D.layer3D.utils.*;
    import mortal.game.scene3D.map3D.AstarAnyDirection.data.*;
    import mortal.game.scene3D.map3D.util.*;
    import mortal.game.scene3D.player.entity.*;
    import mortal.game.scene3D.player.info.*;
    import mortal.game.scene3D.player.item.*;
    import mortal.game.utils.*;
    import mortal.game.view.common.*;
    import mortal.game.view.common.guide.*;
    import mortal.game.view.common.guide.data.*;
    import mortal.game.view.common.guide.view.*;
    import mortal.game.view.common.util.*;
    import mortal.game.view.copy.ChallengeCopy.view.*;
    import mortal.game.view.copy.defenseCopy.*;
    import mortal.game.view.fashionOnline.data.*;
    import mortal.game.view.funcPreView.*;
    import mortal.game.view.guide.guideUse.*;
    import mortal.game.view.hangCount.*;
    import mortal.game.view.investmentProject.*;
    import mortal.game.view.levelReward.*;
    import mortal.game.view.npc.*;
    import mortal.game.view.palyer.data.*;
    import mortal.game.view.palyer.util.*;
    import mortal.game.view.rebate.item.*;
    import mortal.game.view.shopMall.data.*;
    import mortal.game.view.shopMall.view.*;
    import mortal.game.view.signUp.sevenDayLogin.panel.*;
    import mortal.game.view.skill.*;
    import mortal.game.view.systemSetting.*;
    import mortal.game.view.task.data.*;
    import mortal.game.view.task.drama.*;
    import mortal.game.view.vip.panel.*;
    import mortal.game.view.wizard.data.*;
    import mortal.mvc.core.*;

    public class GuideController extends Controller
    {
        private var _itemToBeUseList:Vector.<GuideUseItemData>;
        private var _itemWin:GuideItemUseWin;
        private var _equipWin:GuideEquipUseWin;
        private var _specialEquipWin:GuideSpecialEquipUseWin;
        private var _wizardEquipWin:GuideWizardEquipWin;
        private var _halidomWin:GuideHalidomUseWin;
        private var _runeWin:GuideRuneUseWin;
        private var _waittingForAutoGuideTask:TaskInfo;
        private var _waittingForSceneUpdatedGuideTask:TaskInfo;
        private var _autoTask_10Seconds:GuideAutoDoTask;
        private var _guideOnlieEquip:GuideOnlineEquip;
        private var _allInited:Boolean = false;
        private var _isFirstTimeInGame:Boolean = false;
        private var _sceneUpdateAutoFightTime:Number = -1;
        private var _guideXPView:GuideUseXPSkillView;
        public var hasAskServerBuyItem:Boolean = false;
        private var _flyBootData:Object;
        private var _isFirstIn:Boolean = true;
        private var _angerAutoGuideData:AutoGuideData;
        public var ismustOrange:Boolean = false;
        public var lastPickoutCode:int = -1;
        public static var isLinkByAutoTask:Boolean = false;
        public static var currentGuideItemWin:Object;

        public function GuideController()
        {
            this._itemToBeUseList = new Vector.<GuideUseItemData>;
            return;
        }// end function

        public function get isFirstTimeInGame() : Boolean
        {
            return this._isFirstTimeInGame;
        }// end function

        override protected function initServer() : void
        {
            Dispatcher.addEventListener(EventName.NavbarButtonUIRowInited, this.allInitedHandler);
            NetDispatcher.addCmdListener(ServerCommand.BackPackItemsAdd, this.packItemAddHandler);
            Dispatcher.addEventListener(EventName.Guide_ItemUseClick, this.itemUseClickedHandler);
            Dispatcher.addEventListener(EventName.Guide_FirstTimeInGame, this.firstTimeInGameHandler);
            NetDispatcher.addCmdListener(ServerCommand.TaskUpdate, this.taskUpdateHandler);
            NetDispatcher.addCmdListener(ServerCommand.TaskDoingAdd, this.taskDoingAddHandler);
            Dispatcher.addEventListener(EventName.AutoGuideMainEnd, this.autoGuideMainEndHandler);
            Dispatcher.addEventListener(EventName.Guide_GuideGuildFinished, this.guideJionGuildEndHandler);
            Dispatcher.addEventListener(EventName.Guide_OnlineEquip, this.guideOnleEquipHandler);
            Dispatcher.addEventListener(EventName.Scene_Update, this.sceneUpdateHandler);
            NetDispatcher.addCmdListener(EGateCommand._ECmdGateRevivalPropNotEnough, this.hintToBuyRevivalPropHandler);
            NetDispatcher.addCmdListener(EGateCommand._ECmdGateConveyPropNotEnough, this.hintToBuyFlyBootHandler);
            Dispatcher.addEventListener("GuidePetFuseChooseSecondPet", this.guidePetChooseHandler);
            NetDispatcher.addCmdListener(ServerCommand.RoleLevelUpdate, this.levelUpdateHandler);
            Dispatcher.addEventListener(EventName.LoginGameSuccess, this.levelUpdateHandler);
            NetDispatcher.addCmdListener(ServerCommand.FashionOnlineFashionUpdate, this.onFashionRewardUpdate);
            Dispatcher.addEventListener(EventName.StageResize, this.stageResizeHandler);
            Dispatcher.addEventListener(EventName.ShowActionLayerIcon, this.showActionLayerIconHandler);
            Dispatcher.addEventListener(EventName.AutoGuide_RightDownIcon, this.guideRightDownHadler);
            Dispatcher.addEventListener(EventName.AutoGuide_RightDownIconEnd, this.guideRightDownEndHadler);
            Dispatcher.addEventListener(EventName.AutoGuideGuidingEquipTransform, this.guideTransformHandler);
            Dispatcher.addEventListener(EventName.AutoGuideEnterCopyAutoFight, this.enterCopyThenAutoFightHandler);
            Dispatcher.addEventListener(EventName.AutoGuidePopupModule, this.popupModuleHandler);
            Dispatcher.addEventListener(EventName.AutoGuidePlayerRolling, this.showGuidePlayerRollingSwf);
            Dispatcher.addEventListener(EventName.AutoGuideAutoFight_A, this.guideAutoFight);
            Dispatcher.addEventListener(EventName.AutoGuideShowBackpack, this.showBackpackHandler);
            Dispatcher.addEventListener(EventName.AutoGuideZCRRDHOpenShop, this.guideZCRRDHOpenShop);
            Dispatcher.addEventListener(EventName.AutoGuideWing, this.showGuideWing);
            Dispatcher.addEventListener(EventName.AutoGuideLevelReward, this.guideLevelRewardHandler);
            Dispatcher.addEventListener(EventName.AutoGuideSevenDayShow, this.showSevenDay);
            NetDispatcher.addCmdListener(ServerCommand.BackPackItemDel, this.onDelItemHandler);
            NetDispatcher.addCmdListener(ServerCommand.GroupPlayerInfoChange, this.updateTeamMate);
            Dispatcher.addEventListener(EventName.AutoGuideShowBackPackItem, this.packItemUseHandler);
            NetDispatcher.addCmdListener(ServerCommand.HonorUpdate, this.guideHonorBuyHandler);
            NetDispatcher.addCmdListener(ServerCommand.ExploitUpdate, this.guideExploitBuyHandler);
            GuideWhenNoOperation.instance.work();
            Dispatcher.addEventListener(EventName.DropItem, this.dropItemHandler);
            NetDispatcher.addCmdListener(ServerCommand.BackPackItemsReduction, this.itemUsedHandler);
            NetDispatcher.addCmdListener(EPublicCommand._ECmdPublicAReallocation, this.relocateHandler);
            return;
        }// end function

        public function relocateHandler(param1:MessageBlock) : void
        {
            GuideWhenRelocateCrossServer.instance.startWork(param1.messageBase as SMovePoint);
            return;
        }// end function

        private function itemUsedHandler(param1:Array) : void
        {
            var _loc_3:Point = null;
            var _loc_2:* = param1[0] as ItemData;
            if (_loc_2 == null)
            {
                return;
            }
            if (ItemsUtil.isDrugMana(_loc_2) || ItemsUtil.isDrugManaBag(_loc_2))
            {
                _loc_3 = new Point(Global.stage.stageWidth / 2, Global.stage.stageHeight / 2);
                GuideFlyEffect.instance.work(_loc_3, new Point(270, 56), 18, 80, null, GuideFlyEffect.color_Blue);
            }
            else if (ItemsUtil.isDrugLife(_loc_2) || ItemsUtil.isDrugLifeBag(_loc_2))
            {
                _loc_3 = new Point(Global.stage.stageWidth / 2, Global.stage.stageHeight / 2);
                GuideFlyEffect.instance.work(_loc_3, new Point(255, 56), 18, 80, null, GuideFlyEffect.color_Red);
            }
            return;
        }// end function

        private function dropItemHandler(event:DataEvent) : void
        {
            if (AutoFightAI.isWorking)
            {
                return;
            }
            var _loc_2:* = ThingUtil.dropItemUtil.getDorpItemByItemUnit(4);
            if (_loc_2 == null)
            {
                return;
            }
            var _loc_3:* = GeomUtil.calcDistance(_loc_2.x2d, _loc_2.y2d, RolePlayer.instance.x2d, RolePlayer.instance.y2d);
            if (_loc_3 > 500)
            {
                return;
            }
            Dispatcher.dispatchEvent(new DataEvent(EventName.AutoGuideActiveByEvent, {mainId:1, stepId:1}));
            return;
        }// end function

        private function showSevenDay(param1) : void
        {
            AutoGuideCache.isGuidingSevenDay = true;
            Dispatcher.dispatchEvent(new DataEvent(EventName.SevenDayLoginOpneModule));
            return;
        }// end function

        private function guideLevelRewardHandler(param1) : void
        {
            AutoGuideCache.isGuidingLevelReward = true;
            Dispatcher.dispatchEvent(new DataEvent(EventName.SignUpOpenWinAndSwitchTag, 1));
            return;
        }// end function

        public function guideExploitBuyHandler(param1 = null) : void
        {
            if (AutoGuideController.isGuiding && AutoGuideController._guidingMainId == 44)
            {
                return;
            }
            if (!GameController.autoGuide.hasGuideExploitBuy())
            {
                if (cache.role.money.exploit >= 1000)
                {
                    Dispatcher.dispatchEvent(new DataEvent(EventName.AutoGuideActiveByEvent, {mainId:44, stepId:1}));
                }
            }
            return;
        }// end function

        private function guideHonorBuyHandler(param1) : void
        {
            if (!GameController.autoGuide.hasGuideHonorBuy())
            {
                if (cache.role.money.honor >= 4000)
                {
                    Dispatcher.dispatchEvent(new DataEvent(EventName.AutoGuideActiveByEvent, {mainId:43, stepId:1}));
                }
            }
            return;
        }// end function

        private function guideZCRRDHOpenShop(event:DataEvent) : void
        {
            Dispatcher.dispatchEvent(new DataEvent(EventName.ShopMallChangeTabIndex, [ShopUtil.ShopTabWarHonorShop]));
            return;
        }// end function

        private function showGuideWing(param1) : void
        {
            AutoGuideCache.isGuideFuncPanel = true;
            Dispatcher.dispatchEvent(new DataEvent(EventName.PlayerModuleShowIndexByType, PlayerConst.TabType_Wing));
            return;
        }// end function

        private function showBackpackHandler(event:DataEvent) : void
        {
            var nextFrameToGuide35_2:Function;
            var evt:* = event;
            nextFrameToGuide35_2 = function () : void
            {
                var _loc_1:* = AutoGuideConfig.instance.getConfigs(["mainId", "stepId"], [35, 3])[0] as AutoGuideData;
                var _loc_2:* = GameController.pack.getCanOpenGridPos();
                if (_loc_1 != null && _loc_2 != null)
                {
                    _loc_1.clickChildName = _loc_2.x + ";" + _loc_2.y + ";" + _loc_2.width + ";" + _loc_2.height;
                    Dispatcher.dispatchEvent(new DataEvent(EventName.AutoGuideActiveByEvent, {mainId:35, stepId:3}));
                }
                return;
            }// end function
            ;
            if (GameController.pack.view.isHide)
            {
                GameManager.instance.popupModuleType(ModuleType.Pack);
            }
            setTimeout(nextFrameToGuide35_2, 300);
            return;
        }// end function

        private function guideAutoFight(event:DataEvent) : void
        {
            new GuideAutoFight().show();
            return;
        }// end function

        private function showGuidePlayerRollingSwf(event:DataEvent) : void
        {
            new GuidePlayerRollingView().show();
            return;
        }// end function

        public function guideUseXp(param1:Boolean = true) : void
        {
            if (param1 && SkillUtil.isShouldGuideUseXPSkill())
            {
                if (GuideUseXPSkillView.hasInstance && GuideUseXPSkillView.instance.isHide)
                {
                    GuideUseXPSkillView.instance.show();
                    GuideUseXPSkillView.instance.updateSkill(Cache.instance.wizard.fightWizardData.tSpriteEx.xpskillId);
                }
                GuideUseXPSkillView.instance.updateShowTime();
            }
            else if (GuideUseXPSkillView.hasInstance && !GuideUseXPSkillView.instance.isHide)
            {
                GuideUseXPSkillView.instance.hide();
            }
            return;
        }// end function

        private function popupModuleHandler(event:DataEvent) : void
        {
            var _loc_2:* = event.data as String;
            if (_loc_2 == ModuleType.Guild)
            {
                if (GameController.guild.isViewShow)
                {
                    return;
                }
            }
            GameManager.instance.popupModuleType(_loc_2);
            return;
        }// end function

        private function enterCopyThenAutoFightHandler(param1) : void
        {
            this._sceneUpdateAutoFightTime = FrameManager.flashFrame.getTime() + 9000;
            return;
        }// end function

        private function guideTransformHandler(event:DataEvent) : void
        {
            AutoGuideCache.isGuidingEquipTransform = true;
            return;
        }// end function

        private function guideRightDownHadler(event:DataEvent) : void
        {
            var _loc_2:GuideUseWinBase = null;
            var _loc_3:GuideUseItemData = null;
            if (this._itemWin != null && !this._itemWin.isHide)
            {
                _loc_2 = this._itemWin;
            }
            if (this._equipWin != null && !this._equipWin.isHide)
            {
                _loc_2 = this._equipWin;
            }
            if (this._halidomWin != null && !this._halidomWin.isHide)
            {
                _loc_2 = this._halidomWin;
            }
            if (_loc_2 != null)
            {
                _loc_2.isNotUseNext = true;
                _loc_2.hide();
                _loc_2.isNotUseNext = false;
                if (_loc_2.itemData != null)
                {
                    _loc_3 = new GuideUseItemData();
                    _loc_3.itemData = _loc_2.itemData;
                    this._itemToBeUseList.unshift(_loc_3);
                }
            }
            return;
        }// end function

        private function guideRightDownEndHadler(event:DataEvent) : void
        {
            this.useNextItem();
            return;
        }// end function

        private function showActionLayerIconHandler(event:DataEvent) : void
        {
            var _loc_2:* = event.data as String;
            switch(_loc_2)
            {
                case "ChallengeCopyIcon":
                {
                    ChallengeCopyIcon.instance.show();
                    break;
                }
                case "WelfareIcon":
                {
                    WelfareIcon.instance.show();
                    break;
                }
                case "FashionOnlineIcon":
                {
                    break;
                }
                case "VipFirstRechargeIcon":
                {
                    VipFirstRechargeIcon.instance.show();
                    break;
                }
                case "RebateIcon":
                {
                    RebateIcon.instance.show();
                    break;
                }
                case "InvestmentIcon":
                {
                    InvestmentIcon.instance.show();
                    break;
                }
                case "SevenDayLoginIcon":
                {
                    SevenDayLoginIcon.instance.show();
                    break;
                }
                default:
                {
                    break;
                }
            }
            LayerManager.actionIconLayer.updateAllIconPositon();
            return;
        }// end function

        private function stageResizeHandler(event:DataEvent) : void
        {
            if (this._guideOnlieEquip != null && !this._guideOnlieEquip.isHide)
            {
                this._guideOnlieEquip.stageResize();
            }
            return;
        }// end function

        private function onFashionRewardUpdate(param1) : void
        {
            if (this._guideOnlieEquip == null || this._guideOnlieEquip.isHide)
            {
                return;
            }
            if (cache.fashionOnline.getFirstFashionState() == FashionOnlineConst.FashionState_Taked)
            {
                this._guideOnlieEquip.hide();
                this._guideOnlieEquip = null;
            }
            return;
        }// end function

        public function set isShowGuideOnlineFashion(param1:Boolean) : void
        {
            if (param1)
            {
                this.showOnlineEquipGuide();
            }
            else if (this._guideOnlieEquip)
            {
                this._guideOnlieEquip.hide();
            }
            return;
        }// end function

        private function allInitedHandler(event:DataEvent) : void
        {
            Dispatcher.removeEventListener(EventName.NavbarButtonUIRowInited, this.allInitedHandler);
            this.showOnlineEquipGuide();
            this._allInited = true;
            if (GameController.autoGuide.hasGuideLevelReward())
            {
                WelfareIcon.instance.show();
            }
            if (GameController.autoGuide.hasGuideZXSZ())
            {
            }
            this.checkAndShowFuncPreView();
            return;
        }// end function

        private function updateTeamMate(param1 = null) : void
        {
            if (!FuncPreviewModule.hasInstanceShowing())
            {
                return;
            }
            if (FuncPreviewUtil.instance.shouldShowModule())
            {
                FuncPreviewModule.instance.expand();
            }
            else
            {
                FuncPreviewModule.instance.unExpand();
            }
            return;
        }// end function

        private function checkAndShowFuncPreView() : void
        {
            var _loc_1:* = cache.role.roleInfo.level;
            var _loc_2:* = FuncPreCofonfig.instance.getNextFuncPreView(_loc_1);
            if (_loc_2 != null && _loc_1 >= 5)
            {
                FuncPreviewModule.instance.show();
                FuncPreviewModule.instance.updateConfig(_loc_2);
            }
            else if (FuncPreviewModule.hasInstance())
            {
                FuncPreviewModule.instance.updateConfig(null);
                FuncPreviewModule.instance.hide();
            }
            return;
        }// end function

        private function guideOnleEquipHandler(event:DataEvent) : void
        {
            return;
        }// end function

        private function showOnlineEquipGuide() : void
        {
            if (cache.fashionOnline.getFirstFashionState() == FashionOnlineConst.FashionState_Taked)
            {
                return;
            }
            if (!ClientSetting.local.getIsDone(IsDoneType.HasDoneSZZXTask))
            {
                return;
            }
            if (this._guideOnlieEquip == null)
            {
                this._guideOnlieEquip = new GuideOnlineEquip();
            }
            this._guideOnlieEquip.show();
            this._guideOnlieEquip.updateLeftTime();
            return;
        }// end function

        public function get guideOnlieEquip() : GuideOnlineEquip
        {
            return this._guideOnlieEquip;
        }// end function

        private function levelUpdateHandler(param1 = null) : void
        {
            if (this._allInited)
            {
                if (GameController.autoGuide.hasGuideLevelReward())
                {
                    WelfareIcon.instance.show();
                }
                if (GameController.autoGuide.hasGuideChallengeCopy())
                {
                    ChallengeCopyIcon.instance.show();
                }
                this.checkAndShowFuncPreView();
            }
            if (cache.role.roleInfo.level >= GameConst.TaskAutoDoLv)
            {
                if (this._autoTask_10Seconds != null)
                {
                    this._autoTask_10Seconds.stop();
                    this._autoTask_10Seconds = null;
                }
                return;
            }
            else
            {
                if (this._autoTask_10Seconds == null)
                {
                    this._autoTask_10Seconds = new GuideAutoDoTask();
                }
                this._autoTask_10Seconds.work();
            }
            return;
        }// end function

        private function guidePetChooseHandler(event:DataEvent) : void
        {
            return;
        }// end function

        private function hintToBuyRevivalPropHandler(param1:MessageBlock) : void
        {
            this.buyRevivalProp();
            return;
        }// end function

        public function buyRevivalProp(param1:Boolean = false) : void
        {
            NetDispatcher.addCmdListener(ServerCommand.BackPackItemsAdd, this.revivalItemAddHandler);
            this.hasAskServerBuyItem = false;
            var _loc_2:* = ShopConfig.instance.getFastBuyItemByCode(GameConst.RelivePropItemId);
            _loc_2.isUseGoldBuyGoldBind = true;
            var _loc_3:* = PulseSharedObject.isTodayNotTips(TodayNoTipsConst.buyRevivalProp) || AutoFightAI.isWorking && cache.autoFight.isAutoBuyPropForRelieve;
            if (_loc_3 || param1)
            {
                _loc_2.num = 1;
                _loc_2.npcId = 0;
                Dispatcher.dispatchEvent(new DataEvent(EventName.BuyItem, _loc_2));
                return;
            }
            BuyPropWin.instance.addEventListener(WindowEvent.CLOSE, this.buyRevivalCloseHandler);
            BuyPropWin.instance.showWin(_loc_2, 0);
            BuyPropWin.instance.todayNotTipsType = TodayNoTipsConst.buyRevivalProp;
            return;
        }// end function

        private function buyRevivalCloseHandler(event:WindowEvent) : void
        {
            BuyPropWin.instance.removeEventListener(WindowEvent.CLOSE, this.buyRevivalCloseHandler);
            if (!this.hasAskServerBuyItem)
            {
                NetDispatcher.removeCmdListener(ServerCommand.BackPackItemsAdd, this.revivalItemAddHandler);
            }
            return;
        }// end function

        private function revivalItemAddHandler(param1:Object) : void
        {
            var _loc_2:* = ItemData(param1[0]);
            if (ItemsUtil.isRevivalProp(_loc_2))
            {
                NetDispatcher.removeCmdListener(ServerCommand.BackPackItemsAdd, this.revivalItemAddHandler);
                GameProxy.sceneProxy.relive(ERevival._ERevivalSitu);
            }
            return;
        }// end function

        public function checkAndBuyFlyBoot(param1:Function) : void
        {
            var _loc_2:* = Cache.instance.pack.backPackCache.getItemCountByCategoryAndType(EGroup._EGroupProp, EProp._EPropProp, EPropType._EPropTypeConvey);
            if (Cache.instance.vip.freeFlyBootTimes == 0 && _loc_2 <= 0)
            {
                this.buyFlyBoot(param1);
            }
            else
            {
                param1.apply();
            }
            return;
        }// end function

        public function hintToBuyFlyBootHandler(param1:MessageBlock) : void
        {
            this.buyFlyBoot(null);
            return;
        }// end function

        public function buyFlyBoot(param1) : void
        {
            var _loc_3:SPassTo = null;
            this._flyBootData = param1;
            if (param1 is SPassTo)
            {
                _loc_3 = param1 as SPassTo;
                if (GameMapUtil.shouldUseAutoPathReplaceFlyBoot(_loc_3.mapId, _loc_3.toPoint.x, _loc_3.toPoint.y))
                {
                    AIManager.onAIControl(AIType.FlyBoot, _loc_3);
                    return;
                }
            }
            this.hasAskServerBuyItem = false;
            NetDispatcher.addCmdListener(ServerCommand.BackPackItemsAdd, this.flyBootItemAddHandler);
            var _loc_2:* = ShopConfig.instance.getFastBuyItemByCode(180130001);
            if (PulseSharedObject.isTodayNotTips(TodayNoTipsConst.buyFlyBoot))
            {
                _loc_2.num = 1;
                _loc_2.npcId = 0;
                Dispatcher.dispatchEvent(new DataEvent(EventName.BuyItem, _loc_2));
                return;
            }
            MsgManager.showRollTipsMsg(Language.getString(21022));
            BuyPropWin.instance.addEventListener(WindowEvent.CLOSE, this.buyFlyBootCloseHandler);
            BuyPropWin.instance.showWin(_loc_2, 0);
            BuyPropWin.instance.todayNotTipsType = TodayNoTipsConst.buyFlyBoot;
            return;
        }// end function

        private function buyFlyBootCloseHandler(event:WindowEvent) : void
        {
            BuyPropWin.instance.removeEventListener(WindowEvent.CLOSE, this.buyFlyBootCloseHandler);
            if (!this.hasAskServerBuyItem && !ShopFeaturTips.isShowing)
            {
                NetDispatcher.removeCmdListener(ServerCommand.BackPackItemsAdd, this.flyBootItemAddHandler);
            }
            else if (ShopFeaturTips.isShowing)
            {
                ShopFeaturTips.closeCallback = this.buyFlyBootShopFeatureClosed;
            }
            return;
        }// end function

        private function buyFlyBootShopFeatureClosed() : void
        {
            if (!this.hasAskServerBuyItem)
            {
                NetDispatcher.removeCmdListener(ServerCommand.BackPackItemsAdd, this.flyBootItemAddHandler);
            }
            return;
        }// end function

        private function flyBootItemAddHandler(param1:Object) : void
        {
            var _loc_2:* = ItemData(param1[0]);
            if (ItemsUtil.isFlyBoot(_loc_2))
            {
                NetDispatcher.removeCmdListener(ServerCommand.BackPackItemsAdd, this.flyBootItemAddHandler);
                if (this._flyBootData is GLinkTextData)
                {
                    Dispatcher.dispatchEvent(new DataEvent(EventName.FlyBoot_GLinkText, this._flyBootData));
                    this._flyBootData = null;
                }
                else if (this._flyBootData is SPassTo)
                {
                    Dispatcher.dispatchEvent(new DataEvent(EventName.FlyBoot, this._flyBootData));
                    this._flyBootData = null;
                }
                else if (this._flyBootData is Function)
                {
                    (this._flyBootData as Function).apply();
                }
            }
            return;
        }// end function

        private function sceneUpdateHandler(event:DataEvent) : void
        {
            var evt:* = event;
            if (GuideAutoFightWin.isWorking())
            {
                if (!GuideAutoFightWin.instance.isWaitForFlyBoot)
                {
                    GuideAutoFightWin.instance.hide();
                }
            }
            if (HangCountWin.hasInstance() && !HangCountWin.instance.isHide)
            {
                GameController.hangStatistics.onEndHangUp();
            }
            if (this._waittingForSceneUpdatedGuideTask != null)
            {
                this.guideAutoPathToNextStep(this._waittingForSceneUpdatedGuideTask);
                this._waittingForSceneUpdatedGuideTask = null;
            }
            var flyTask:* = cache.task.getFlyTaskLinkData();
            if (flyTask != null)
            {
                TaskUtil.linkTask(flyTask);
            }
            if (this._isFirstIn)
            {
                this._isFirstIn = false;
                cache.role.roleEntityInfo.addEventListener(EntityInfoEventName.RoleOutFighting, this.roleOutFightingHandler);
            }
            if (FrameManager.flashFrame.getTime() <= this._sceneUpdateAutoFightTime)
            {
                var nextFrame:* = function () : void
            {
                Dispatcher.dispatchEvent(new DataEvent(EventName.AutoFight_A));
                return;
            }// end function
            ;
                CallLater.setCallLater(nextFrame, 1);
            }
            if (!MoveByPathAI.working)
            {
                return;
            }
            this.checkAndUpMount();
            return;
        }// end function

        private function roleOutFightingHandler(event:EntityInfoEvent) : void
        {
            if (!MoveByPathAI.working)
            {
                return;
            }
            if (MoveByPathAI.curDis < GameConst.UpMountMinDistance)
            {
                return;
            }
            this.checkAndUpMount();
            return;
        }// end function

        public function checkAndUpMount() : void
        {
            if (Global.isDebugModle)
            {
            }
            if (Cache.instance.role.roleEntityInfo.reserveJs.maincity_flag)
            {
                return;
            }
            if (RolePlayer.instance.entityInfo.isInPVPFighting())
            {
                return;
            }
            if (!GameController.autoGuide.hasGuideMount())
            {
                return;
            }
            if (!Game.sceneInfo.limitInfo.canSingleMount())
            {
                return;
            }
            if (cache.task.isDrama || TaskDramaOperator.isInFlyDrama)
            {
                return;
            }
            if (RolePlayer.instance.entityInfo.isDisappear)
            {
                return;
            }
            if (CopyUtil.isInAllEscortTask)
            {
                return;
            }
            if (RolePlayer.instance.isInSwinArea)
            {
                return;
            }
            Dispatcher.dispatchEvent(new DataEvent(EventName.MountRide, EMountState._EMountStateRide));
            return;
        }// end function

        private function guideJionGuildEndHandler(event:DataEvent) : void
        {
            this.resumeToTask();
            return;
        }// end function

        private function get angerAutoGuideData() : AutoGuideData
        {
            if (this._angerAutoGuideData == null)
            {
                this._angerAutoGuideData = AutoGuideConfig.instance.getConfigs(["mainId", "stepId"], [9, 1])[0] as AutoGuideData;
            }
            return this._angerAutoGuideData;
        }// end function

        public function autoGuideMainEndHandler(event:DataEvent) : void
        {
            this.checkAndShowFuncPreView();
            var _loc_2:* = event.data as AutoGuideData;
            if (_loc_2 != null)
            {
                if (_loc_2.mainId == 9 || _loc_2.mainId == 12)
                {
                    return;
                }
            }
            if (GuideController.shouldResumeToTaskAfterGuide() && _loc_2.filterName != "NoMainEndType")
            {
                this.resumeToTask();
            }
            return;
        }// end function

        public function resumeToTask(param1:int = -1) : Boolean
        {
            var _loc_4:TaskInfo = null;
            if (this._waittingForAutoGuideTask == null)
            {
                this._waittingForAutoGuideTask = cache.task.getNextAutoPathTask();
            }
            if (this._waittingForAutoGuideTask == null)
            {
                return false;
            }
            if (NpcTaskDialogModule.isShowing && NpcTaskDialogModule.showingTaskInfo == this._waittingForAutoGuideTask)
            {
                return false;
            }
            var _loc_2:* = this._waittingForAutoGuideTask.stask.group;
            if (_loc_2 != ETaskGroup._ETaskGroupMain && (_loc_2 != param1 || param1 == ETaskGroup._ETaskGroupLoop))
            {
                _loc_4 = cache.task.getNextAutoPathTask();
                if (_loc_4 != null && _loc_4.stask.group == ETaskGroup._ETaskGroupMain)
                {
                    this._waittingForAutoGuideTask = _loc_4;
                }
            }
            if (Cache.instance.task.getLinkTextData(this._waittingForAutoGuideTask.stask.code) == null)
            {
                if (GameController.task.isJuseFinishedGroup(ETaskGroup._ETaskGroupLoop))
                {
                    this._waittingForAutoGuideTask = cache.task.getNextAutoPathTask(ETaskGroup._ETaskGroupLoop);
                }
                else
                {
                    this._waittingForAutoGuideTask = cache.task.getNextAutoPathTask();
                }
            }
            if (this._waittingForAutoGuideTask == null)
            {
                return false;
            }
            var _loc_3:* = this._waittingForAutoGuideTask;
            this._waittingForAutoGuideTask = null;
            return this.guideAutoPathToNextStep(_loc_3);
        }// end function

        private function taskDoingAddHandler(param1:int) : void
        {
            var task:TaskInfo;
            var nextFrameTaskAdd:Function;
            var taskList:Array;
            var code:* = param1;
            nextFrameTaskAdd = function () : void
            {
                if (AutoGuideController.isGuiding)
                {
                    _waittingForAutoGuideTask = task;
                    return;
                }
                guideAutoPathToNextStep(task);
                return;
            }// end function
            ;
            task = Cache.instance.task.getTaskByCode(code);
            if (task == null)
            {
                return;
            }
            if (TaskUtil.checkAndShowFlyGuide(task))
            {
                return;
            }
            if (task.stask.group == ETaskGroup._ETaskGroupMinning)
            {
                return;
            }
            if (task.stask.group == ETaskGroup._ETaskGroupGuild)
            {
                if (!task.playerTask.canShare && !this.ismustOrange)
                {
                    TaskUtil.linkTask(task);
                }
                this.ismustOrange = false;
                return;
            }
            this.ismustOrange = false;
            if (cache.npc.selectedNpc != null && cache.npc.selectedNpc.npcInfo != null)
            {
                taskList = cache.npc.getTaskListByNpcId(cache.npc.selectedNpc.npcInfo.tnpc.code);
                if (taskList != null && taskList.length > 0)
                {
                    return;
                }
            }
            CallLater.addCallBack(nextFrameTaskAdd);
            return;
        }// end function

        private function taskUpdateHandler(param1:Object) : void
        {
            var nextFrameTaskUpdate:Function;
            var obj:* = param1;
            nextFrameTaskUpdate = function () : void
            {
                var playerTask:SPlayerTaskUpdate;
                var task:TaskInfo;
                var arr:* = obj as Array;
                if (arr == null || arr.length == 0)
                {
                    return;
                }
                var i:int;
                while (i < arr.length)
                {
                    
                    playerTask = arr[i] as SPlayerTaskUpdate;
                    task = Cache.instance.task.getTaskByCode(playerTask.taskCode);
                    if (task == null)
                    {
                    }
                    else
                    {
                        if (task.maxStatus >= ETaskStatus._ETaskStatusCantEnd)
                        {
                            if (cache.role.roleInfo.level >= GameConst.TaskAutoDoLv)
                            {
                                ;
                            }
                        }
                        if (CopyUtil.isInCopy && !cache.guild.isInSelfGuild && task.maxStatus >= ETaskStatus._ETaskStatusCantEnd)
                        {
                        }
                        else
                        {
                            if (task.stask.code == GameConst.GuideDefenceCopyTaskCode)
                            {
                                if (task.isComplete())
                                {
                                    GameController.copy.showGuideLeaveArrow(true);
                                    return;
                                }
                                if (task.curStep != task.lastStep && task.curStep == 2)
                                {
                                    var timeToGuideDefenseCopy:* = function () : void
                {
                    guideAutoPathToNextStep(task);
                    return;
                }// end function
                ;
                                    AIManager.cancelAll();
                                    CallLater.setCallLater(timeToGuideDefenseCopy, 0.3);
                                    return;
                                }
                            }
                            if (task.curStep == task.lastStep && !task.isComplete())
                            {
                            }
                            else if (task.isComplete() && TaskUtil.isLoopTask(task))
                            {
                            }
                            else if (task.isCanNotEnd())
                            {
                            }
                            else
                            {
                                if (AutoGuideController.isGuiding)
                                {
                                    _waittingForAutoGuideTask = task;
                                    return;
                                }
                                if (CopyUtil.isInDefenseCopy)
                                {
                                    return;
                                }
                                if (AutoFightAI.isWorking && AutoFightBossSelectAI.instance.onlyIds == null)
                                {
                                    if (cache.role.roleInfo.level > GameConst.TaskAutoDoLv || task.stask.group != ETaskGroup._ETaskGroupMain)
                                    {
                                        if (!CopyUtil.isInCopy)
                                        {
                                            ;
                                        }
                                    }
                                }
                                guideAutoPathToNextStep(task);
                                return;
                            }
                        }
                    }
                    i = (i + 1);
                }
                return;
            }// end function
            ;
            if (this._isFirstTimeInGame)
            {
                return;
            }
            CallLater.addCallBack(nextFrameTaskUpdate);
            return;
        }// end function

        public function guideAutoPathToNextStep(param1:TaskInfo) : Boolean
        {
            var _loc_5:GLinkTextData = null;
            var _loc_6:String = null;
            var _loc_7:int = 0;
            if (param1 == null)
            {
                return false;
            }
            if (!ClientSetting.local.getIsDone(IsDoneType.HasCloseWelComeWin) && cache.role.roleInfo != null && cache.role.roleInfo.level == 1)
            {
                return false;
            }
            if (param1.isComplete() && param1.isCanQuickFinish)
            {
                return false;
            }
            if (Game.scene == null || !Game.scene.isInitialize)
            {
                this._waittingForSceneUpdatedGuideTask = param1;
                return false;
            }
            if (GameController.task.isStopingAllDrama)
            {
                return false;
            }
            if (cache.task.isDrama || TaskDramaOperator.isInFlyDrama)
            {
                return false;
            }
            if (AutoGuideNewFunc.isShowing || AutoGuideNewSkill.isShowing)
            {
                AutoGuideNewFunc.hasCloseTaskWin = true;
                return false;
            }
            if (AutoFightAI.isWorking && AIManager.curAI is AutoFightAI)
            {
                this._waittingForAutoGuideTask = param1;
                (AIManager.curAI as AutoFightAI).pickupEndToTask(param1.stask.group);
                return false;
            }
            if (param1.stask != null)
            {
                if (param1.isCanget() && param1.stask.autoGet)
                {
                    return false;
                }
                if (param1.isComplete() && param1.stask.autoEnd)
                {
                    return false;
                }
                if (param1.isCanNotEnd())
                {
                    return false;
                }
            }
            var _loc_2:* = Cache.instance.task.getLinkTextData(param1.stask.code);
            if (_loc_2 == null)
            {
                return false;
            }
            var _loc_3:* = _loc_2[param1.curStep];
            if (_loc_3 == null)
            {
                return false;
            }
            var _loc_4:int = 0;
            while (_loc_4 < _loc_3.length)
            {
                
                _loc_5 = _loc_3[_loc_4];
                _loc_6 = _loc_5.htmlText;
                if (_loc_6 == null)
                {
                    Alert.show("新类型任务没解析到，所以GLinkText的htmlText=null， 任务code = " + param1.stask.code);
                    return false;
                }
                _loc_7 = _loc_6.indexOf("event:Event");
                if (_loc_7 < 0)
                {
                    isLinkByAutoTask = true;
                    Dispatcher.dispatchEvent(new DataEvent(EventName.TaskTraceTargetEvent, _loc_5));
                    isLinkByAutoTask = false;
                    return true;
                }
                _loc_4++;
            }
            return false;
        }// end function

        private function itemUseClickedHandler(event:DataEvent) : void
        {
            var _loc_2:* = event.data as ItemData;
            Dispatcher.dispatchEvent(new DataEvent(EventName.BackPack_Use, _loc_2));
            return;
        }// end function

        public function showEnterCrossNormalTipsWin() : void
        {
            var _loc_1:* = ClockManager.instance.nowDate.date;
            var _loc_2:* = ClientSetting.local.enterCrossNormalDate;
            if (_loc_1 != _loc_2)
            {
                ClientSetting.local.enterCrossNormalDate = _loc_1;
                ClientSetting.save(true);
                GuideEnterCrossNormalTipsWin.instance.show();
            }
            return;
        }// end function

        private function firstTimeInGameHandler(event:DataEvent) : void
        {
            this._isFirstTimeInGame = true;
            Alert.mode = Alert.Mode_None;
            Alert.alertWinRenderer = GuideWelcomeWin;
            Alert.show("", "", 0, null, this.welcomeCloseHandler);
            return;
        }// end function

        private function welcomeCloseHandler(param1:int) : void
        {
            this._isFirstTimeInGame = false;
            ClientSetting.local.setIsDone(true, IsDoneType.HasCloseWelComeWin);
            ClientSetting.save(true);
            var _loc_2:* = Cache.instance.task.getMinCodeDoingTask();
            if (_loc_2 == null)
            {
                return;
            }
            TaskUtil.linkTask(_loc_2);
            return;
        }// end function

        public function useNextItem() : void
        {
            var _loc_3:ItemData = null;
            var _loc_4:ItemData = null;
            var _loc_5:ItemData = null;
            var _loc_6:MountPackCache = null;
            var _loc_7:ItemData = null;
            var _loc_8:HalidomPackCache = null;
            var _loc_9:FashionAdvanceData = null;
            var _loc_10:FashionPackCache = null;
            var _loc_11:ItemData = null;
            var _loc_12:WizardData = null;
            var _loc_13:WizardPackCache = null;
            var _loc_14:ItemData = null;
            if (!this._itemToBeUseList || this._itemToBeUseList.length == 0)
            {
                return;
            }
            if (this._itemWin != null && !this._itemWin.isHide)
            {
                return;
            }
            if (this._equipWin != null && !this._equipWin.isHide)
            {
                return;
            }
            if (this._halidomWin != null && !this._halidomWin.isHide)
            {
                return;
            }
            if (this._specialEquipWin != null && !this._specialEquipWin.isHide)
            {
                return;
            }
            if (this._wizardEquipWin != null && !this._wizardEquipWin.isHide)
            {
                return;
            }
            if (this._runeWin != null && !this._runeWin.isHide)
            {
                return;
            }
            var _loc_1:* = this._itemToBeUseList.shift();
            var _loc_2:* = _loc_1.itemData;
            if (_loc_2 == null)
            {
                this.useNextItem();
                return;
            }
            if (ItemsUtil.isRune(_loc_2.itemInfo))
            {
                if (!ItemsUtil.isFitCarrer(_loc_2))
                {
                    this.useNextItem();
                    return;
                }
                if (!ItemsUtil.isEnoughLevel(_loc_2))
                {
                    this.useNextItem();
                    return;
                }
                _loc_3 = cache.pack.runeBag.getItemDataByPoseType(_loc_2.itemInfo.type);
                if (_loc_3 != null && RuneCache.calcRunesCombat(_loc_3) >= RuneCache.calcRunesCombat(_loc_2))
                {
                    this.useNextItem();
                    return;
                }
                if (this._runeWin == null)
                {
                    this._runeWin = new GuideRuneUseWin();
                }
                this._runeWin.show();
                this._runeWin.guideUseData = _loc_1;
            }
            else if (ItemsUtil.isEquip(_loc_2))
            {
                if (!ItemsUtil.isFitCarrer(_loc_2))
                {
                    this.useNextItem();
                    return;
                }
                if (!ItemsUtil.isEnoughLevel(_loc_2))
                {
                    this.useNextItem();
                    return;
                }
                _loc_3 = Cache.instance.pack.packRolePackCache.getEquipByType(_loc_2.itemInfo.type);
                if (_loc_3 != null && EquipmentUtil.getEquipBaseCombat(_loc_3) >= EquipmentUtil.getEquipBaseCombat(_loc_2))
                {
                    this.useNextItem();
                    return;
                }
                if (this._equipWin == null)
                {
                    this._equipWin = new GuideEquipUseWin();
                }
                this._equipWin.show();
                this._equipWin.guideUseData = _loc_1;
            }
            else if (ItemsUtil.isHalidomEquip(_loc_2))
            {
                if (!ItemsUtil.isFitCarrer(_loc_2))
                {
                    this.useNextItem();
                    return;
                }
                if (!ItemsUtil.isEnoughLevel(_loc_2))
                {
                    this.useNextItem();
                    return;
                }
                _loc_4 = Cache.instance.pack.halidomBag.getEquipByType(_loc_2.itemInfo.type);
                if (_loc_4 != null && EquipmentUtil.getEquipBaseCombat(_loc_4) >= EquipmentUtil.getEquipBaseCombat(_loc_2))
                {
                    this.useNextItem();
                    return;
                }
                if (this._halidomWin == null)
                {
                    this._halidomWin = new GuideHalidomUseWin();
                }
                this._halidomWin.show();
                this._halidomWin.guideUseData = _loc_1;
            }
            else if (ItemsUtil.isMountEquip(_loc_2))
            {
                if (_loc_2.itemInfo.level > Cache.instance.mount.mountData.mountLevel)
                {
                    this.useNextItem();
                    return;
                }
                if (_loc_2.itemInfo.type != EEquipMount._EEquipMountShape)
                {
                    _loc_5 = Cache.instance.pack.mountPackCache.getEquipByType(_loc_2.itemInfo.type);
                    if (_loc_5 && MountUtil.getMountEquipCombatByItemData(_loc_5) >= MountUtil.getMountEquipCombatByItemData(_loc_2))
                    {
                        this.useNextItem();
                        return;
                    }
                }
                else
                {
                    _loc_6 = Cache.instance.pack.mountPackCache;
                    if (_loc_6)
                    {
                        _loc_5 = _loc_6.getItemByCode(_loc_2.itemCode, true);
                        if (_loc_5)
                        {
                            this.useNextItem();
                            return;
                        }
                    }
                    else
                    {
                        this.useNextItem();
                        return;
                    }
                }
                if (this._specialEquipWin == null)
                {
                    this._specialEquipWin = new GuideSpecialEquipUseWin();
                }
                this._specialEquipWin.show();
                this._specialEquipWin.guideUseData = _loc_1;
            }
            else if (ItemsUtil.isPetEquip(_loc_2))
            {
                if (Cache.instance.newPet.pet && _loc_2.itemInfo.level > Cache.instance.newPet.pet.code)
                {
                    this.useNextItem();
                    return;
                }
                if (_loc_2.itemInfo.type != EPet2Equip._EPet2EquipShape)
                {
                    _loc_7 = Cache.instance.pack.petBag.getEquipByType(_loc_2.itemInfo.type);
                    if (_loc_7 && MountUtil.getMountEquipCombatByItemData(_loc_7) >= MountUtil.getMountEquipCombatByItemData(_loc_2))
                    {
                        this.useNextItem();
                        return;
                    }
                }
                else
                {
                    _loc_8 = Cache.instance.pack.petBag;
                    if (_loc_8)
                    {
                        _loc_7 = _loc_8.getItemByCode(_loc_2.itemCode, true);
                        if (_loc_7)
                        {
                            this.useNextItem();
                            return;
                        }
                    }
                    else
                    {
                        this.useNextItem();
                        return;
                    }
                }
                if (this._specialEquipWin == null)
                {
                    this._specialEquipWin = new GuideSpecialEquipUseWin();
                }
                this._specialEquipWin.show();
                this._specialEquipWin.guideUseData = _loc_1;
            }
            else if (ItemsUtil.isFashionEquip(_loc_2))
            {
                _loc_9 = Cache.instance.fashion.getFashionInfo(FashionUtil.getEquipFashionType(_loc_2));
                if (_loc_9 && _loc_9.advanceInfo)
                {
                    if (_loc_2.itemInfo.level > _loc_9.advanceInfo.code)
                    {
                        this.useNextItem();
                        return;
                    }
                    switch(_loc_2.itemInfo.category)
                    {
                        case EProp._EPropFashionClothesEquip:
                        {
                            _loc_10 = Cache.instance.pack.getFashionPackCacheByCode(EAdvanceComponentType._EAdvanceComponentTypeClothes);
                            break;
                        }
                        case EProp._EPropFashionWingEquip:
                        {
                            _loc_10 = Cache.instance.pack.getFashionPackCacheByCode(EAdvanceComponentType._EAdvanceComponentTypeWing);
                            break;
                        }
                        case EProp._EPropFashionWeaponEquip:
                        {
                            _loc_10 = Cache.instance.pack.getFashionPackCacheByCode(EAdvanceComponentType._EAdvanceComponentTypeWeapon);
                            break;
                        }
                        case EProp._EPropFashionFightSoulEquip:
                        {
                            _loc_10 = Cache.instance.pack.getFashionPackCacheByCode(EAdvanceComponentType._EAdvanceComponentTypeFightSoul);
                            break;
                        }
                        case EProp._EPropFashionFightMethodEquip:
                        {
                            _loc_10 = Cache.instance.pack.getFashionPackCacheByCode(EAdvanceComponentType._EAdvanceComponentTypeFightMethod);
                            break;
                        }
                        case EProp._EPropFashionDragonSoulEquip:
                        {
                            _loc_10 = Cache.instance.pack.getFashionPackCacheByCode(EAdvanceComponentType._EAdvanceComponentTypeDragonSoul);
                            break;
                        }
                        case EProp._EPropFashionHolyBookEquip:
                        {
                            _loc_10 = Cache.instance.pack.getFashionPackCacheByCode(EAdvanceComponentType._EAdvanceComponentTypeHolyBook);
                            break;
                        }
                        case EProp._EPropFashionWarShieldEquip:
                        {
                            _loc_10 = Cache.instance.pack.getFashionPackCacheByCode(EAdvanceComponentType._EAdvanceComponentTypeWarShield);
                            break;
                        }
                        case EProp._EPropFashionMonsterSoulEquip:
                        {
                            _loc_10 = Cache.instance.pack.getFashionPackCacheByCode(EAdvanceComponentType._EAdvanceComponentTypeMonsterSoul);
                            break;
                        }
                        default:
                        {
                            break;
                        }
                    }
                    if (_loc_10 == null)
                    {
                        this.useNextItem();
                        return;
                    }
                    if (_loc_2.itemInfo.type != EEquipFashionClothes._EEquipFashionClothesShape)
                    {
                        _loc_11 = _loc_10.getEquipByType(_loc_2.itemInfo.type);
                        if (_loc_11 && MountUtil.getMountEquipCombatByItemData(_loc_11) >= MountUtil.getMountEquipCombatByItemData(_loc_2))
                        {
                            this.useNextItem();
                            return;
                        }
                    }
                    else
                    {
                        _loc_11 = _loc_10.getItemByCode(_loc_2.itemCode, true);
                        if (_loc_11)
                        {
                            this.useNextItem();
                            return;
                        }
                    }
                    if (this._specialEquipWin == null)
                    {
                        this._specialEquipWin = new GuideSpecialEquipUseWin();
                    }
                    this._specialEquipWin.show();
                    this._specialEquipWin.guideUseData = _loc_1;
                }
            }
            else if (ItemsUtil.isWizardEquip(_loc_2))
            {
                _loc_12 = Cache.instance.wizard.getWizardDataByCode(_loc_2.itemInfo.effectEx);
                if (_loc_12 && _loc_2.itemInfo.level > _loc_12.tSprite.level)
                {
                    this.useNextItem();
                    return;
                }
                _loc_13 = Cache.instance.pack.getWizardPackCacheByCode(_loc_2.itemInfo.effectEx);
                if (_loc_13 == null)
                {
                    this.useNextItem();
                    return;
                }
                _loc_14 = _loc_13.getEquipByType(_loc_2.itemInfo.type);
                if (_loc_14 && MountUtil.getMountEquipCombatByItemData(_loc_14) >= MountUtil.getMountEquipCombatByItemData(_loc_2))
                {
                    this.useNextItem();
                    return;
                }
                if (this._wizardEquipWin == null)
                {
                    this._wizardEquipWin = new GuideWizardEquipWin();
                }
                this._wizardEquipWin.show();
                this._wizardEquipWin.guideUseData = _loc_1;
            }
            else if (ItemsUtil.isMonetaryCard(_loc_2))
            {
                if (DefenseCopyUtil.isInDefenseCopy())
                {
                    this.useNextItem();
                    return;
                }
                _loc_1.isUseMaxNum = true;
                this.showItemWin(_loc_1);
            }
            else if (ItemsUtil.isMedal(_loc_2))
            {
                _loc_1.isCountdown = false;
                this.showItemWin(_loc_1);
            }
            else if (ItemsUtil.isActiveTitleItem(_loc_2))
            {
                this.showItemWin(_loc_1);
            }
            else if (ItemsUtil.isFixedGiftBag(_loc_2))
            {
                _loc_1.isUseMaxNum = true;
                this.showItemWin(_loc_1);
            }
            else if (_loc_1.isGuideToUseItem)
            {
                this.showItemWin(_loc_1);
            }
            else if (_loc_2.extData == UpdateCode.EUpdateCodeTaskAndGuide)
            {
                if (ItemsUtil.isAdvanceItemAndOver3Level(_loc_2))
                {
                    this.useNextItem();
                }
                else
                {
                    if (ItemsUtil.isMountAdvanced(_loc_2))
                    {
                        GuideController.currentGuideItemWin = ModuleType.Mounts;
                    }
                    else if (ItemsUtil.isSpriteStone(_loc_2))
                    {
                        GuideController.currentGuideItemWin = ModuleType.Wizard;
                    }
                    else if (ItemsUtil.isPetAdvanced(_loc_2))
                    {
                        GuideController.currentGuideItemWin = ModuleType.Pets;
                    }
                    else if (ItemsUtil.isStrengthTone(_loc_2))
                    {
                        GuideController.currentGuideItemWin = ModuleType.Build;
                    }
                    else if (ItemsUtil.isFashionAdvanceProp(_loc_2))
                    {
                        GuideController.currentGuideItemWin = ModuleType.Fashion;
                    }
                    this.showItemWin(_loc_1);
                }
            }
            else
            {
                this.useNextItem();
            }
            return;
        }// end function

        private function showItemWin(param1:GuideUseItemData) : void
        {
            if (this._itemWin == null)
            {
                this._itemWin = new GuideItemUseWin();
            }
            this._itemWin.show();
            this._itemWin.guideUseData = param1;
            return;
        }// end function

        private function packItemUseHandler(event:DataEvent) : void
        {
            var _loc_3:Boolean = false;
            var _loc_4:int = 0;
            var _loc_5:ItemData = null;
            var _loc_2:* = event.data as GuideUseItemData;
            if (this._itemWin && !this._itemWin.isHide && this._itemWin.itemData.serverData.uid == _loc_2.itemData.serverData.uid)
            {
                this._itemWin.guideUseData = this._itemWin.guideUseItemData;
            }
            else
            {
                _loc_4 = 0;
                while (_loc_4 < this._itemToBeUseList.length)
                {
                    
                    _loc_5 = this._itemToBeUseList[_loc_4].itemData as ItemData;
                    if (_loc_5.serverData.uid == _loc_2.itemData.serverData.uid)
                    {
                        _loc_3 = true;
                        break;
                    }
                    _loc_4++;
                }
                if (!_loc_3)
                {
                    this._itemToBeUseList.push(_loc_2);
                    this.useNextItem();
                }
            }
            return;
        }// end function

        private function packItemAddHandler(param1:Object) : void
        {
            var _loc_5:Boolean = false;
            var _loc_6:int = 0;
            var _loc_7:ItemData = null;
            var _loc_8:GuideUseItemData = null;
            var _loc_2:* = int(param1[1]);
            var _loc_3:* = param1[0] as ItemData;
            var _loc_4:Boolean = true;
            if (_loc_3.serverData.posType == EPlayerItemPosType._EPlayerItemPosTypeDefenseCopyBag)
            {
                if (_loc_3 != null && CopyUtil.isInGuideDefenseCopy)
                {
                    if (_loc_3.itemCode == GameConst.GuideDefenceEquipEquipmentCode)
                    {
                        Dispatcher.dispatchEvent(new DataEvent(EventName.AutoGuideActiveByEvent, {mainId:33, stepId:1}));
                    }
                }
            }
            if (_loc_3.serverData.posType != EPlayerItemPosType._EPlayerItemPosTypeBag)
            {
                return;
            }
            if (!GameMapUtil.curMapState.isHoleBoss && !ItemsUtil.isBelongToDefense(_loc_3))
            {
                GuidePickupItemFly.instance.checkAndFlyToBackpack(_loc_3.itemCode);
            }
            if (_loc_2 == UpdateCode.EUpdateCodeGetTodayOnlineReward)
            {
                return;
            }
            if (_loc_2 != 0 && (_loc_2 == UpdateCode.EUpdateCodeGift || _loc_2 == UpdateCode.EUpdateCodeLevelGift))
            {
                GuideMidFlytoPack.instance.addNext(_loc_3);
            }
            else if (_loc_2 == UpdateCode.EUpdateCodeTask && this.lastPickoutCode > 0)
            {
                if (_loc_3.itemCode != this.lastPickoutCode)
                {
                    this.lastPickoutCode = -1;
                    return;
                }
                this.lastPickoutCode = -1;
            }
            else if (_loc_2 == UpdateCode.EUpdateCodeTaskAndGuide)
            {
                if (ItemsUtil.isSpiterActivate(_loc_3))
                {
                    AutoGuideCache.isGuidingAutoUseWizardBook = true;
                    GameController.pack.useItem(_loc_3);
                    return;
                }
                AIManager.cancelAll();
            }
            if (this._itemWin && !this._itemWin.isHide && this._itemWin.itemData.serverData.uid == _loc_3.serverData.uid)
            {
                this._itemWin.guideUseData = this._itemWin.guideUseItemData;
            }
            else
            {
                _loc_6 = 0;
                while (_loc_6 < this._itemToBeUseList.length)
                {
                    
                    _loc_7 = this._itemToBeUseList[_loc_6].itemData as ItemData;
                    if (_loc_7.serverData.uid == _loc_3.serverData.uid)
                    {
                        _loc_5 = true;
                        break;
                    }
                    _loc_6++;
                }
                if (!_loc_5)
                {
                    _loc_8 = new GuideUseItemData();
                    _loc_8.itemData = _loc_3;
                    _loc_8.isCountdown = _loc_4;
                    this._itemToBeUseList.push(_loc_8);
                    _loc_3.extData = _loc_2;
                    this.useNextItem();
                }
            }
            return;
        }// end function

        public function get equipWin() : GuideEquipUseWin
        {
            return this._equipWin;
        }// end function

        public function hideForDrama(param1:Boolean = true) : void
        {
            if (this._itemWin != null && !this._itemWin.isHide)
            {
                this._itemWin.hideForDrama(param1);
            }
            if (this._equipWin != null && !this._equipWin.isHide)
            {
                this._equipWin.hideForDrama(param1);
            }
            if (this._halidomWin != null && !this._halidomWin.isHide)
            {
                this._halidomWin.hideForDrama(param1);
            }
            return;
        }// end function

        private function onDelItemHandler(param1:Object) : void
        {
            var _loc_3:int = 0;
            var _loc_4:ItemData = null;
            var _loc_2:* = param1 as ItemData;
            if (_loc_2)
            {
                if (this._equipWin && !this._equipWin.isHide && this._equipWin.itemData.serverData.uid == _loc_2.serverData.uid)
                {
                    this._equipWin.hide();
                    return;
                }
                if (this._halidomWin && !this._halidomWin.isHide && this._halidomWin.itemData.serverData.uid == _loc_2.serverData.uid)
                {
                    this._halidomWin.hide();
                    return;
                }
                if (this._itemWin && !this._itemWin.isHide && this._itemWin.itemData.serverData.uid == _loc_2.serverData.uid)
                {
                    this._itemWin.hide();
                    return;
                }
                if (this._specialEquipWin && !this._specialEquipWin.isHide && this._specialEquipWin.itemData.serverData.uid == _loc_2.serverData.uid)
                {
                    this._specialEquipWin.hide();
                    return;
                }
                if (this._wizardEquipWin && !this._wizardEquipWin.isHide && this._wizardEquipWin.itemData.serverData.uid == _loc_2.serverData.uid)
                {
                    this._wizardEquipWin.hide();
                    return;
                }
                _loc_3 = 0;
                while (_loc_3 < this._itemToBeUseList.length)
                {
                    
                    _loc_4 = this._itemToBeUseList[_loc_3].itemData as ItemData;
                    if (_loc_4.serverData.uid == _loc_2.serverData.uid)
                    {
                        this._itemToBeUseList.splice(_loc_3, 1);
                        _loc_3 = _loc_3 - 1;
                        break;
                    }
                    _loc_3++;
                }
            }
            return;
        }// end function

        public static function shouldResumeToTaskAfterGuide() : Boolean
        {
            if (CopyUtil.isInCopy && Cache.instance.role.roleInfo.level > 40)
            {
                return false;
            }
            return true;
        }// end function

    }
}
